import { useStore } from 'vuex';
import {toRefs} from 'vue';
export const useCart = () => {
    const store = useStore();
    // 设置cartList为store.state的cartList的值
    const {cartList}=toRefs(store.state);
    // 设置changeCart方法，执行store中的changeItemToCart方法
    const changeCart = (shopId, productId, productInfo, num,shopName) => {
        store.commit('changeItemToCart', { shopId, productId, productInfo, num,shopName });
    };
    // 导出changeCart方法和cartList
    return { changeCart,cartList };
}